package com.sbr.tbd.camel;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by IntelliJ IDEA.
 * User: Sébastien
 * Date: 16/05/11
 * Time: 22:20
 * To change this template use File | Settings | File Templates.
 */
public class LogRoute extends RouteBuilder {

private static final Logger LOG = LoggerFactory.getLogger(LogRoute.class);

    @Override
    public void configure() throws Exception {

        from("stream:file?fileName=C:/Projets/serveurs/apache-servicemix-4.3.0-fuse-03-00/data/log/servicemix.log" +
                "&scanStream=true&scanStreamDelay=1000").log("log:LOG").to("log:LOG?level=ERROR");
    }

    public static void main(String[] args) {
        CamelContext context = new DefaultCamelContext();
        try {
            context.addRoutes(new LogRoute());
        } catch (Exception e) {
            LOG.error("ERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRROOOOOOOOOOOOOOOORRRRRRRRR",e);
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        try {
            context.start();
        } catch (Exception e) {
            LOG.error("ERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRROOOOOOOOOOOOOOOORRRRRRRRR",e);
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }

        while(true) {
            
        }

    }
}
